/*
 * Copyright 2014 by État de Genève (Switzerland)
 * All rights reserved.
 *
 * Author: ELCA Informatique SA
 */
define([],
    function () {

        var actionsWidgetCtor = function() {
            this.commands = [];
            this.isDisabled = false;
        };

        actionsWidgetCtor.prototype.activate = viewActivate;
        actionsWidgetCtor.prototype.commandClick = cmdClick;

        return actionsWidgetCtor;

        function cmdClick(command) {
            var c = _.indexOf(this.commands, command);

            if(c >= 0) {
                this.commands[c].callback();
            }

            return false;
        }

        function viewActivate (settings) {
            this.commands = settings.commands;
            if (settings.isDisabled) {
                this.isDisabled = settings.isDisabled;
            }
        }

    });